//
//  TopListTableViewCell.m
//  BaChat
//
//  Created by 刘洋 on 16/6/16.
//  Copyright © 2016年 刘洋. All rights reserved.
//

#import "TopListTableViewCell.h"

@interface TopListTableViewCell ()

@property(nonatomic,retain)UIView *lineView;


@end



@implementation TopListTableViewCell

-(void)dealloc{
    [_newCounts release];
    [_titleLabel release];
    [_titleImage release];
    [_lineView release];
    [super dealloc];
}



-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
    
}



-(void)createSubViews{
    
   
    self.titleImage = [[BaseImageView alloc]init];
    self.titleImage.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.titleImage];
    [_titleImage release];
    
    self.titleLabel = [[BaseLabel alloc]init];
    self.titleLabel.font = [UIFont systemFontOfSize:17];
    self.titleLabel.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.titleLabel];
    [_titleLabel release];
    
    
    
    self.newCounts = [[BaseLabel alloc]init];
    self.newCounts.backgroundColor = [UIColor redColor];
    self.newCounts.font = [UIFont systemFontOfSize:10];
    self.newCounts.textColor = [UIColor whiteColor];
    self.newCounts.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.newCounts];
    [_newCounts release];
    
    
    self.lineView = [[UIView alloc]init];
    self.lineView.backgroundColor = RGBAColor(220, 220, 220);
    [self.contentView addSubview:self.lineView];
    [_lineView release];
    
    
}

-(void)layoutSubviews{
    
    [super layoutSubviews];
    
    self.titleImage.frame = CGRectMake(10, 5, 50, 50);
    
    self.titleLabel.frame = CGRectMake(self.titleImage.frame.origin.x + self.titleImage.frame.size.width + 10, 10, ROOTWIDTH / 2, 40);
    
    self.newCounts.frame = CGRectMake(45, 5, 20, 20);
    self.newCounts.layer.masksToBounds = YES;
    self.newCounts.layer.cornerRadius = 10;
    
    self.lineView.frame = CGRectMake(10, 60, ROOTWIDTH - 20, 1);
    
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
